package com.ruoyi.asms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.asms.domain.FaultInfoView;
import com.ruoyi.asms.mapper.FaultInfoViewMapper;
import com.ruoyi.asms.service.IFaultInfoViewService;
import com.ruoyi.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 故障信息视图Service业务层处理
 * 
 * @author yfkj
 * @date 2021-11-01
 */
@Service
public class FaultInfoViewServiceImpl extends ServiceImpl<FaultInfoViewMapper, FaultInfoView>  implements IFaultInfoViewService
{
    @Autowired
    private FaultInfoViewMapper faultInfoViewMapper;

    /**
     * 查询故障信息视图
     * 
     * @param faultAssetId 故障信息视图主键
     * @return 故障信息视图
     */
    @Override
    public FaultInfoView selectFaultInfoViewByFaultAssetId(Long faultAssetId)
    {
        return faultInfoViewMapper.selectFaultInfoViewByFaultAssetId(faultAssetId);
    }

    /**
     * 查询故障信息视图列表
     * 
     * @param faultInfoView 故障信息视图
     * @return 故障信息视图
     */
    @Override
    public List<FaultInfoView> selectFaultInfoViewList(FaultInfoView faultInfoView)
    {
        return faultInfoViewMapper.selectFaultInfoViewList(faultInfoView);
    }

    /**
     * 新增故障信息视图
     * 
     * @param faultInfoView 故障信息视图
     * @return 结果
     */
    @Override
    public int insertFaultInfoView(FaultInfoView faultInfoView)
    {
        faultInfoView.setCreateTime(System.currentTimeMillis());
        faultInfoView.setCreateBy(SecurityUtils.getUsername());
        return faultInfoViewMapper.insertFaultInfoView(faultInfoView);
    }

    /**
     * 修改故障信息视图
     * 
     * @param faultInfoView 故障信息视图
     * @return 结果
     */
    @Override
    public int updateFaultInfoView(FaultInfoView faultInfoView)
    {
        faultInfoView.setUpdateTime(System.currentTimeMillis());
        faultInfoView.setUpdateBy(SecurityUtils.getUsername());

        return faultInfoViewMapper.updateFaultInfoView(faultInfoView);
    }

    /**
     * 批量删除故障信息视图
     * 
     * @param faultAssetIds 需要删除的故障信息视图主键
     * @return 结果
     */
    @Override
    public int deleteFaultInfoViewByFaultAssetIds(Long[] faultAssetIds)
    {
        return faultInfoViewMapper.deleteFaultInfoViewByFaultAssetIds(faultAssetIds);
    }

    /**
     * 删除故障信息视图信息
     * 
     * @param faultAssetId 故障信息视图主键
     * @return 结果
     */
    @Override
    public int deleteFaultInfoViewByFaultAssetId(Long faultAssetId)
    {
        return faultInfoViewMapper.deleteFaultInfoViewByFaultAssetId(faultAssetId);
    }
}
